<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>浮动</title>
    <style>
        /* 
            1. 开启浮动之后元素脱离文档流，飘起来了
            2. 开启浮动的元素，默认情况下被内容撑开，可以设置宽高和内外边距
            3. 浮动原来是用来做文字环绕图片效果的
        */
        div {
            font-size: 20px;
            height: 500px;
            background-color: gray;
        }

        .box1,
        .box2,
        .box3 {
            height: 100px;
        }

        .box1 {
            background-color: palevioletred;
        }

        .box2 {
            background-color: greenyellow;
            float: left;
            width: 100px;
            margin: 0 10px;
        }

        .box3 {
            background-color: aquamarine;
            float: left;
            width: 100px;
            margin: 0 10px;
        }
    </style>
</head>

<body>
    <div>
        <div class="box1">1</div>
        <div class="box2">2</div>
        <div class="box3">3</div>
    </div>
</body>

</html>